package com.wyx.suanfa;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class designLinkList {
    public static void main(String[] args) {

    }
}

/*
class MyLinkedList {
    int size;
    ListNode head;

    public MyLinkedList() {
        size = 0;
        head = new ListNode(0);

    }

    public int get(int index) {
        if(index < 0 || index >= size){
            return -1;
        }

        ListNode p = head;
        for(int i = 0;i<=index;i++){
            p = p.next;
        }
        return p.val;

    }

    public void addAtHead(int val) {
        addAtIndex(0,val);
    }

    public void addAtTail(int val) {
        addAtIndex(size,val);

    }

    public void addAtIndex(int index, int val) {
        if(index > size){
            return;
        }
        if(index < 0){
            index = 0;
        }

        //找到要插入节点的前驱结点
        ListNode pre  = head;
        for(int i = 0;i<index;i++){
            pre = pre.next;
        }
        ListNode newNode = new ListNode(val);
        newNode.next = pre.next;
        pre.next = newNode;

        size++;

    }


    public void deleteAtIndex(int index) {
        if(index < 0 || index >= size){
            return;
        }

        ListNode p = head;
        for(int i = 0;i<index;i++){
            p = p.next;
        }

        p.next = p.next.next;
        size--;
    }
}*/

/*class ListNode{
    int val;
    ListNode next;

    ListNode(){}

    public ListNode(int val){
        this.val = val;
    }
}*/
